< previous page page_162 next page >

Page 162
Declaring a Global Compiler Constant
To declare a public compiler constant (one that will be available to your entire application), you need to go to the Tools, Options menu and select the Advanced tab as shown in Figure 8.1.
8160-0162a.gif
Figure 8.1
The Project Properties window.
In the Conditional Compilation text box, enter the constant name, an equal sign, and the value to assign. When you create the constant name, it must follow the naming rules for a Visual Basic variable. The value you assign to the constant can only be a numeric value. You can place multiple values in this text box by separating them with colons (:). Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
cconLANGUAGE = 0 : cconDEBUGCODE = -1
Declaring a Module-level Compiler Constant
You can declare compiler constants in the General Declarations section of a module. However, the compiler constants you define here have scope only within that module. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
' General Declarations Section
Option Explicit

#Const cconLANGUAGE = 0

 
< previous page page_162 next page >

If you like this book, buy it!